<template>
    <el-dialog v-model="dialogFormVisible" :title="form.id ? '编辑地址' : '添加地址'" width="500">
        <el-form :model="form">
            <itemInput label="所属用户" v-model="form.user_name"/>
            <itemCity label="省市区" 
                v-model:province="form.province" 
                v-model:provinceName="form.provinceName"
                v-model:city="form.city"
                v-model:cityName="form.cityName"
                v-model:area="form.area"
                v-model:areaName="form.areaName"/>
        </el-form>
        <template #footer>
            <div class="dialog-footer">
                <el-button type="primary" @click="submits">提交</el-button>
            </div>
        </template>
    </el-dialog>
</template>
<script>
import itemInput from '@/components/form/item.input.vue'
import itemCity from '@/components/form/item.city.vue'
export default {
    data() {
        return {
            formLabelWidth: '120px',
            dialogFormVisible: false,
            form: {}
        }
    },
    methods:{
        // 打开弹窗显示
        Open(res={}){
            this.form = JSON.parse(JSON.stringify(res));
            this.dialogFormVisible = true;
        },
        // 提交表单
        submits(){
            console.log("forms",this.form)
        }
    },
    components: {
        itemInput,
        itemCity,
    },
}
</script>